<?php
apf_require_class('Dao_DAO');

class Dao_Portal_HomeProjectView extends DAO{

    public function inc_view_count($uid, $pid){
        if(intval($uid) == 0 || intval($pid) == 0){
            return false;
        }
        $sql = "INSERT INTO `home_project_view` (`uid`,`pid`,`count`) VALUES ({$uid}, {$pid}, 1) ON DUPLICATE KEY UPDATE `count` = `count` + 1;";
        $rs = $this->execute($sql, array(), true);

        return $rs;
    }


    public function get_table_name(){
        return 'home_project_view';
    }

    public function get_read_pdo_name(){
        return 'portal_slave';
    }

    public function get_write_pdo_name(){
        return 'portal_master';
    }

    public function get_table_pk(){
        return 'id';
    }

}